package org.robotlegs.xxl.base 
{
	import flash.display.DisplayObjectContainer;
	import org.robotlegs.core.IInjector;
	/**
	 * ...
	 * @author XXL
	 */
	public class ViewMapBase 
	{
		protected var _enabled:Boolean = true;
		
		protected var _contextView:DisplayObjectContainer;
		
		protected var injector:IInjector;
		
		protected var useCapture:Boolean;
		
		protected var viewListenerCount:uint = 0;
		
		public function ViewMapBase(contextView:DisplayObjectContainer, injector:IInjector) 
		{
			this.injector = injector;
			this.useCapture = true;
			this.contextView = contextView;
		}
		
		public function get contextView():DisplayObjectContainer 
		{
			return _contextView;
		}
		
		public function set contextView(value:DisplayObjectContainer):void 
		{
			if (value != _contextView)
			{
				removeListeners();
				_contextView = value;
				if (viewListenerCount > 0)
				{
					addListeners();
				}
			}
		}
		
		public function get enabled():Boolean 
		{
			return _enabled;
		}
		
		public function set enabled(value:Boolean):void 
		{
			if (value != _enabled)
			{
				removeListeners();
				_enabled = value;
				if (viewListenerCount > 0)
				{
					addListeners();
				}
			}
		}
		
		protected function addListeners():void
		{
			
		}
		
		protected function removeListeners():void 
		{
			
		}
		
	}

}